.PHONY: build clean fmt vet test bench cover runRpc runWeb benchInfoRandom benchInfoFix benchLogin

ARGS=
COVERPROFILE=coverage.txt
DEBUG=

build: vendor clean fmt vet test
	go build -o go-web-task main.go

#clean:
#	rm -rf bin/
#	if [ -f "main" ] ; then rm cmd/main; fi
#	if [ -f "coverage.txt" ] ; then rm coverage.txt; fi
#
#	// pprof test
#	go test -v -bench=QueryUser -benchmem -cpuprofile queryProfile.out
# 	go test -v -bench=QueryUser -benchmem -memprofile queryMemProfile.out
# 	go tool pprof queryMemProfile.out

#	go tool pprof -http=":8081" http://localhost:9090/debug/pprof/profile queryProfile.out
#fmt:
#	go fmt ./pkg/...
#	go fmt ./internal/...
#	go fmt ./cmd/...
#
#vendor:
#	go mod vendor
#
#vet:
#	go vet ./pkg/...
#	go vet ./internal/...
#	go vet ./cmd/...
#
#test:
#	go test ./cmd/... -coverprofile=$(COVERPROFILE) -covermode atomic -v -race $(DEBUG) $(ARGS)
#
#cover:
#	$(eval COVERPREFILE += -coverprofile=coverage.out)
#	go test ./cmd/... -cover $(COVERPREFILE) -race $(ARGS) $(DEBUG)
#	go tool cover -html=coverage.out
#	rm -f coverage.out
#
#benchLogin:
#	go test -v -bench=Login -benchmem  -benchtime=60s
#	go test -v ./test -test.bench -test.count 1 -benchtime=60s
#benchInfoFix:
#	go test -v ./cmd/web/router -test.bench InfoFix -test.count 1 -benchtime=60s
#
#benchInfoRandom:
#	go test -v ./cmd/web/router -test.bench InfoRandom -test.count 1 -benchtime=60s
#
#runRpc: vendor
#	go run ./cmd/worker
#
runWeb:	vendor
	go run ./main.go
